import { createBrowserRouter, Navigate } from "react-router-dom"
import Home from "../components/Home"
import Index from "../components/Index"
import Login from "../components/Login"
import Register from "../components/Register"
import Classify from "../components/Classify"
import Scart from "../components/ShoopCart"
import Mine from "../components/Mine"
import Orders from "../components/Orders"
import New from "../components/New"
import Detail from "../components/Detail"
import Member from "../components/Member"

const router = createBrowserRouter([
    { path: "/login", element: <Login></Login> },
    { path: "/register", element: <Register></Register> },
    {
        path: "/index", element: <Index></Index>, children: [
            { path: "/index/home", element: <Home></Home> },
            { path: "/index/classify", element: <Classify></Classify> },
            { path: "/index/scart", element: <Scart></Scart> },
            { path: "/index/mine", element: <Mine></Mine> },
            { path: "/index", element: <Navigate to="/index/home"></Navigate> }
        ]
    },
    { path: "/orders", element: <Orders></Orders> },
    { path: "/new", element: <New></New> },
    { path: "/detail", element: <Detail></Detail> },
    { path: "/member", element: <Member></Member> },
    { path: "/", element: <Navigate to="/index"></Navigate> }
])
export default router